

const audioUrl = {
	// 筛查游戏
	screeningGameLeft : 'https://www.aoc-ppns.cn/static/pa-audio/4-L.mp3',
	screeningGameRight: 'https://www.aoc-ppns.cn/static/pa-audio/4-R.mp3',
	

	// 监测（游戏 单）
	monitorGameLeft : 'https://www.aoc-ppns.cn/static/pa-audio/3-L.mp3',
	monitorGameRight: 'https://www.aoc-ppns.cn/static/pa-audio/3-R.mp3',
	
	// 筛查动作（震颤）
	screeningActionPromptTLeft :'https://www.aoc-ppns.cn/static/pa-audio/2-L.mp3',
	screeningActionPromptTRight :'https://www.aoc-ppns.cn/static/pa-audio/2-R.mp3',
	// (跺脚)
	screeningActionPromptSLeft :'https://www.aoc-ppns.cn/static/pa-audio/5-L.mp3',
	screeningActionPromptSRight :'https://www.aoc-ppns.cn/static/pa-audio/5-R.mp3',

	
	// 倒计时
	actionCountdown :'https://www.aoc-ppns.cn/static/pa-audio/counting_down.mp3',
	// 嘀
	actionDi:'https://www.aoc-ppns.cn/static/pa-audio/beep-with-interval.mp3',

	finish:"https://www.aoc-ppns.cn/static/pa-audio/fin.mp3",

	// 监测(平衡)
	monitorBalanceOpenEye:'https://www.aoc-ppns.cn/static/pa-audio/6.mp3',
	monitorBalanceCloseEye :'https://www.aoc-ppns.cn/static/pa-audio/7.mp3',
	
	// 步态
	gait:"https://www.aoc-ppns.cn/static/pa-audio/12.mp3",
	// （震颤 手）
	monitorActionPromptTLeft :'https://www.aoc-ppns.cn/static/pa-audio/1-L.mp3',
	monitorActionPromptTRight :'https://www.aoc-ppns.cn/static/pa-audio/1-R.mp3',

	// 筛查首页
	monitorHome:"https://www.aoc-ppns.cn/static/pa-audio/setting.mp3"
}

let audioCtx=	uni.createInnerAudioContext();


const audio = function(url,e){
	if(url=="actionDi"){
		audioCtx.loop = true;
	}else{
		audioCtx.loop = false;
	}
	audioCtx.autoplay = true;
	audioCtx.src = audioUrl[url];
	audioCtx.play();
	audioCtx.onPlay(()=>{
		e('audiostart')
	})
	audioCtx.onEnded(()=>{
		console.log('音频播放完了');
	
		audioCtx.stop();
		audioCtx.offEnded();
		e('audioEnd')
	})
	audioCtx.onStop(()=>{
		console.log('音频停止了');
	})
	audioCtx.onError((err)=>{
		console.log(err);
	})
}

export default {audio,audioCtx,audioUrl}